<template>
	<view class="content">
	
		  <web-view :src="url" ></web-view>
		<!-- <shopAdress :adressShow="adressShow" @tz="tz" :adressList="list" @cancelDialog="cancelDialog" @confirmDialog="confirmDialog" @addAddress = 'addAddress'></shopAdress> -->
	</view>
</template>

<script>
import shopAdress from '@/components/shop-adress.vue';
export default {
	components: {
		shopAdress
	},
	data() {
		return {
			page: 1,
			total: 0,
			list: [],
			url:"",
			
			adressShow: true,
			adressList: [
				{
					username: '测试',
					mobile: '1234567890',
					address: '福建省厦门市思明区软件园二期'
				},
				{
					username: '测试2',
					mobile: '1234567890',
					address: '福建省厦门市思明区软件园二期'
				}
			]
		};
	},
	onReachBottom: function() {
		if (this.list.length < this.total) {
			this.page++;
			this.getList();
		}
	},
	onShow(){
		this.getList();
	},
	onLoad() {
		
		this.url = "http://cdnss.myiyou.com/adds/#/?tokens="+uni.getStorageSync('token')
	},
	methods: {
		tz(num){
			uni.navigateTo({
				url:'../index/add?id='+num
			})
		},
		//唤起
		getList(){
			
			uni.showLoading({ title: '正在加载', mask: true });
			var _this = this;
			_this.$api.request('/api/user/address', {page:this.page,	type:this.type}, uni.getStorageSync('token'), function(res) {
				uni.hideLoading();
				if (res.code == 1) {
					_this.total = res.data.total;
					_this.score = res.data.score
					if (_this.page == 1) {
						_this.list = res.data.data;
					} else {
						_this.list = _this.list.concat(res.data.data);
					}
				}
				uni.hideLoading();
			});
		},
		up() {
			this.adressShow = true;
		},
		//取消
		cancelDialog() {
			this.adressShow = false;
		},
		//确定
		confirmDialog(e) {
			console.log(e);
			this.adressShow = false;
		},
		//收货地址
		addAddress(){
			uni.navigateTo({
				url:'../index/add'
			})
		},
	}
};
</script>

<style lang="less"></style>
